﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using CMP.ERP.DAL;
using CMP.ERP.Model;

namespace CMP.ERP.BLL
{
    public class StockBLL
    {
        StockDAL dal = new StockDAL();
        /// <summary>
        /// 获取库存信息
        /// </summary>
        /// <returns></returns>
        public List<Stock> GetStockAll(int PageSize, int PageIndex)
        {
            return dal.GetStockAll(PageSize,PageIndex);
        }
        public int GetStockCount()
        {
            return dal.GetStockCount();

        }
        /// <summary>
        /// 根据id获取库存信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Stock GetStockById(int id)
        {
            return dal.GetStockById(id);
        }
        /// <summary>
        /// 获取商品名称下拉框
        /// </summary>
        /// <returns></returns>
        public List<Commodity> GetCnameAll()
        {
            return dal.GetCnameAll();
        }
        /// <summary>
        /// 获取仓库名称下拉框
        /// </summary>
        /// <returns></returns>
        public List<WareHose> GetWnameAll()
        {
            return dal.GetWnameAll();
        }
        /// <summary>
        /// 更新库存
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public int UpdStock(Stock s)
        {
            return dal.UpdStock(s);
        }
        /// <summary>
        /// 添加库存
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public int AddStock(Stock s)
        {
            return dal.AddStock(s);
        }

        /// <summary>
        /// 根据商品名称查询商品信息
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List<Stock> sousuo(string name, int? WareHose_Id, int PageSize, int PageIndex)
        {
            return dal.sousuo(name, WareHose_Id, PageSize, PageIndex);
        }
        /// <summary>
        ///获取库存数量小于预警数量的个数
        /// </summary>
        /// <returns></returns>
        public int Countearly()
        {
            return dal.Countearly();
        }
        /// <summary>
        /// 预警库存显示
        /// </summary>
        /// <returns></returns>
        public DataTable Jingjie()
        {

            return dal.Jingjie();
        }
    }
}

